import Vue from 'vue'
import Router from 'vue-router'
// 使用router
Vue.use(Router);
import Index from '@/pages/home'
import Demo from '@/pages/home/demo';
import Films from '@/pages/films/index';
import FilmDetail from '@/pages/films/children/detail';
import NowPlaying from '@/pages/films/children/now-playing';
import ComingSoon from '@/pages/films/children/coming-soon';


// 配置路由
const router = new Router({
	routes: [
		//配置首页
		{
			path: '/',
			name: 'index',
			component: Index
		},
		{
			path: '/demo',
			name: 'demo',
			component: Demo
		},
		{
			path: '/films/detail',
			name: 'film-detail',
			component: FilmDetail
		},
		
		{
			path: '/films',
			name: 'films',
			component: Films,
			// 重定向
			redirect:{
				name: 'now-playing'
			},
			children: [
			{
				path: 'now-playing',
				name: 'now-playing',
				component: NowPlaying
			},
			{
				path: 'coming-soon',
				name: 'coming-soon',
				component: ComingSoon
			}
			
		]
	}
	]
});
export default router;
